 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>websocket client</title>
</head>
<script type="text/javascript">
var ws;
function hello(){
    ws = new WebSocket("ws://localhost:8091/WebSocketSrg");
    ws.onopen = function(evn){
        console.log(evn);
		//var int=setInterval("clock()",1000);
    };
    ws.onmessage = function(evn){
        console.log(evn.data);
        var dv = document.getElementById("dv");
         dv.innerHTML=evn.data;
    };
    ws.onclose = function(){
        console.log("close");
    };
    
};
function subsend(){
    var param= document.getElementById('msg').value;
	console.log(param);
    ws.send(param);

}
function subsend11(){
    var param={
  hello:"hi"
};
    ws.send(JSON.stringify(param));

}

function clock()
{
 console.log("clock");
	 var param={
  heat:"heat"
};
   // ws.send(JSON.stringify(param));
}
</script>
<body>
    <h2>Hello World!</h2>
    <div id="dv" ></div>
	<div>
    <input type="button" value="link" onclick="hello()" />
	
    <input type="text" id ="msg" />
	<input type="button" onclick="subsend()" value="send" />
	
	    <input type="text" id ="msg1" /><input type="button" onclick="subsend11()" value="send11" />
	</div>
</body>
</html>